package com.example.demo.mapper;

import com.example.demo.model.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserInfoCompareMapper {
    @Select("select * from user_info where id=#{id}")
    List<UserInfo> selectById(Integer id);

    @Select("select * from user_info where id=${id}")
    List<UserInfo> selectById2(Integer id);

    @Select("select * from user_info where username=#{username}")
    List<UserInfo> selectByName(UserInfo userInfo);

    @Select("select * from user_info where username=${username}")
    List<UserInfo> selectByName2(UserInfo userInfo);

    @Select("select * from user_info where username='${username}'")
    List<UserInfo> selectByName3(UserInfo userInfo);

    @Select("select * from user_info order by ${what} #{order}")
    List<UserInfo> selectOrder(String what,String order);

    @Select("select * from user_info order by ${what} ${order}")
    List<UserInfo> selectOrder2(String what,String order);

    @Select("select * from user_info where ${what} like '%#{name}%'")
    List<UserInfo> selectByLike(String what,String name);

    @Select("select * from user_info where ${what} like '%${name}%'")
    List<UserInfo> selectByLike2(String what,String name);

    @Select("select * from user_info where ${what} like concat('%',#{name},'%')")
    List<UserInfo> selectByLike3(String what,String name);


}
